package com.fit.pages;

import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.fit.interfaces.Employer;
import com.fit.interfaces.User;
import com.fit.service.Employers;

public class ViewEmployer {

	@SessionState
	private User user;
	
	private boolean userExists;

	public User getUser() {
		return user;
	}

	Object onActivate(){
		if(!userExists) return Login.class;
		return null;
	}
	
	@Inject
	@Property
	private Employers employers;
	
	@Property
	private Employer currentEmployer;
	
	@InjectPage
	private EntryBorrow entryBorrow;
	
	@OnEvent(component = "entryDriverLink")
	Object onDriverLink(String name){
		entryBorrow.setBorrowEmployer(name);
		return entryBorrow;
	}
}
